package com.easy.service.impl;


import com.easy.zhu.LogMethod;
import com.easy.bean.FosterBookingBean;
import com.easy.mapper.FosterBookingDao;
import com.easy.service.FosterBookingService;
import com.easy.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FosterBookingServiceImpl implements FosterBookingService {
    @Autowired
    FosterBookingDao fosterBookingDao;
    @Override
    @LogMethod(serviceName = "用户添加处理")
    public FosterBookingBean add(FosterBookingBean fosterBookingBean) {
        fosterBookingDao.add(fosterBookingBean);
        FosterBookingBean result=fosterBookingDao.one(fosterBookingBean.getId());
        return result;
    }

    @Override
    @LogMethod(serviceName = "用户删除处理")
    public int del(Integer id) {
        return fosterBookingDao.del(id);
    }

    @Override
    @LogMethod(serviceName = "用户修改处理")
    public FosterBookingBean edit(FosterBookingBean fosterBookingBean) {
        fosterBookingDao.edit(fosterBookingBean);
        FosterBookingBean result=fosterBookingDao.one(fosterBookingBean.getId());
        return result;
    }

    @Override
    @LogMethod(serviceName = "用户查询处理")
    public FosterBookingBean one(Integer id) {
        return fosterBookingDao.one(id);
    }

    @Override
    @LogMethod(serviceName = "用户查询处理")
    public List<FosterBookingBean> all(FosterBookingBean fosterBookingBean) {
        return fosterBookingDao.all(fosterBookingBean);
    }

    @Override
    @LogMethod(serviceName = "用户分页处理")
    public void page(Page page, FosterBookingBean fosterBookingBean) {
        int count=fosterBookingDao.pageCount(fosterBookingBean);
        Object data=fosterBookingDao.page(page,fosterBookingBean);
        page.setCount(count);
        page.setData(data);

    }
}
